﻿@model MobiShop.Models.Product

@{
    ViewBag.Title = "productCreate";
    Layout = "~/Views/Shared/_AdminStart.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<div class="titleForm">
    <h3>Thêm sản phẩm</h3>
</div>
<div>
    <div class="boxCreateLeft"></div>
    <div class="boxtCreateCenter" style="width:800px;" >
        @using (Html.BeginForm("productCreate", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
        {
            @Html.ValidationSummary(true)
                    <fieldset>
                        <legend></legend>
                        <table>
                            <tr>
                                <td>
                                     @Html.LabelFor(model => model.name)
                                </td>
                                <td>
                                    @Html.TextBoxFor(model => model.name, new { style = "width:250px;" })
                                    @Html.ValidationMessageFor(model => model.name)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.price)
                                </td>
                                <td>
                                    @Html.EditorFor(model => model.price)
                                    @Html.ValidationMessageFor(model => model.price)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.description)
                                </td>
                                <td>
                                    @Html.TextAreaFor(model => model.description, new { @rows = "6", @cols = "80" })
                                    @Html.ValidationMessageFor(model => model.description)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.fullDescription)
                                </td>
                                <td>
                                    @Html.TextAreaFor(model => model.fullDescription, new { @rows = "22", @cols = "80" })
                                    @Html.ValidationMessageFor(model => model.fullDescription)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.image)
                                </td>
                                <td>
                                    <input type='file' name='image' id='image' />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.createDate)
                                </td>
                                <td>
                                    @Html.EditorFor(model => model.createDate)
                                    @Html.ValidationMessageFor(model => model.createDate)
                                </td>
                            </tr>
                            @*<tr>
                                <td>
                                     @Html.LabelFor(model => model.totalView)
                                </td>
                                <td>
                                    @Html.EditorFor(model => model.totalView)
                                    @Html.ValidationMessageFor(model => model.totalView)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.totalSale)
                                </td>
                                <td>
                                    @Html.EditorFor(model => model.totalSale)
                                    @Html.ValidationMessageFor(model => model.totalSale)
                                </td>
                            </tr>*@
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.totalQuantity)
                                </td>
                                <td>
                                    @Html.EditorFor(model => model.totalQuantity)
                                    @Html.ValidationMessageFor(model => model.totalQuantity)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.manufactureId)
                                </td>
                                <td>
                                   @* @Html.EditorFor(model => model.manufactureId)*@
                                    @Html.DropDownList("ManufactureId", "Chọn nhà sản xuất")
                                    @Html.ValidationMessageFor(model => model.manufactureId)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.categoryId)
                                </td>
                                <td>
                                    @*@Html.EditorFor(model => model.categoryId)*@
                                    @Html.DropDownList("CategoryId", "Chọn loại sản phẩm")
                                    @Html.ValidationMessageFor(model => model.categoryId)
                                </td>
                            </tr>
                              <tr>
                                <td>
                                    @Html.LabelFor(model => model.regionId)
                                </td>
                                <td>
                                    @*@Html.EditorFor(model => model.regionId)*@
                                    @Html.DropDownList("RegionId", "Chọn xuất xứ")
                                    @Html.ValidationMessageFor(model => model.regionId)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    @Html.LabelFor(model => model.visible)
                                </td>
                                <td>
                                    @Html.EditorFor(model => model.visible)
                                    @Html.ValidationMessageFor(model => model.visible)
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                                <td>
                                    <input type="hidden" name="ReturnURL" value="@ViewBag.ReturnURL" />
                                    <input type="submit" value="Create" />
                                    @ViewBag.ThongBao
                                </td>
                            </tr>
                        </table>
                    </fieldset>
        }
    </div>
    <div class="boxCreateRight"></div>
</div>
<div class="linkCommand">
@if (ViewBag.ReturnURL == null)
{
    @Html.ActionLink("Trở về", "productList")
}
else
{
    <a href="@ViewBag.ReturnURL">Trở về</a>
}
</div>